package conponent;

import module.StaticSources;
import module.Status;

/**
 * 简单实体工厂
 * 一般情况下，实体对象都应该通过工厂获得，而不是手动创建
 */
public class SimpleEntityFactory {
    /**
     * 获得玩家P1
     */
    public Player createPlayer01(){
        PlayerComp playerComp = new PlayerComp(0, 0, StaticSources.standSouth);
        playerComp.addStatusImage(Status.STAND_SOUTH,StaticSources.standSouth);
        playerComp.addStatusImage(Status.STAND_EAST,StaticSources.standEast);
        playerComp.addStatusImage(Status.STAND_NORTH,StaticSources.standNorth);
        playerComp.addStatusImage(Status.STAND_WEST,StaticSources.standWest);
        MagicBallComp mbc = new MagicBallComp();
        mbc.addMagicProp(new BlankProp());
        playerComp.addMagic(mbc);
        return playerComp;
    }

    /**
     * 获得树对象
     * @param x x坐标
     * @param y y坐标
     * @return 树对象
     */
    public Obstacle createTree(int x,int y){
        return new Obstacle(StaticSources.tree,30*x,30*y);
    }

    public MagicBallComp createMagicBall(MagicBallComp template){
        MagicBallComp mbc = new MagicBallComp();
        mbc.addMagicProp(template.getProperty());
        mbc.setOwner(template.getOwner());
        return mbc;
    }
}
